import flask
# html_txt="""
# <!DOCTYPE html>
# <html>
#     <body>
#         <h2>如果收到get请求</h2>
#         <form method='post'>
#         <input type='submit' value='按下我发送POST请求'/>
#         </form>
#     </body>
# </html>
# """
# app=flask.Flask(__name__)
# @app.route('/',methods=['GET','POST'])
# def helo():
#     if flask.request.method=='GET':
#         return html_txt
#     else:
#         return '我公司已经收到POST请求'

html_txt="""
<!DOCTYPE html>
<html>
    <body>
        <h2>可以收到GET请求</h2>
        <a href='/aaa'>点击我获取Cookie信息</a>
    </body>
</html>
"""
app=flask.Flask(__name__)
@app.route('/<name>')
def set_cks(name):
    name=name if name else 'anonymous'
    resp=flask.make_response(html_txt)
    resp.set_cookie('name',name)
    return resp
@app.route('/aaa')
def get_cks():
    name=flask.request.cookies.get('name')
    return '获取的cookie信息是：'+name
if __name__=='__main__':
    app.run(debug=True)